<template>
  <div id="app">
    <div id="map-container" style="height: 100%;width: 100%;"></div>
  </div>
</template>
 
<script>

export default {
  name: 'App',
  components: {},
  data() {
    return {
      map: null,
    };
  },
  mounted() {
    // 自定义地图
const base_url = '/';
const layers = [
  new AMap.TileLayer({
    getTileUrl: function (x, y, z) {
      return `${base_url}MAP_zxy/${z}/${x}/${y}/tile.png`;
    },
    opacity: 1,
    zIndex: 99,
  }),
];
    this.map = new AMap.Map('map-container', {
      // 设置地图容器id
      resizeEnable: true,
      zoom: 5,
      rotateEnable: true,
      pitchEnable: true,
      center: [116.89, 39.42],
      defaultCursor: 'pointer',
      showLabel: true, //是否显示文字标注
      layers: layers,
    });
    const marker = new AMap.Marker({
      position: new AMap.LngLat(123.43, 41.8), //沈阳的经纬度
      title: '沈阳'
    });
    this.map.add(marker);
    /* this.map.on('click', (e) => {
        this.map.clearMap();
        var marker = new AMap.Marker({
          position: new AMap.LngLat(e.lnglat.getLng(), e.lnglat.getLat()),
        //   icon: Icon, 图标
          offset: new AMap.Pixel(-13, -30),
        });
        this.map.add(marker);
        var text = '您在 [ ' + e.lnglat.getLng() + ',' + e.lnglat.getLat() + ' ] 的位置双击了地图';
        alert(text);
      }); */

  },
  methods: {},
};
</script>

<style lang="less">
.vertical-center-modal {
    display: flex;
    align-items: center;
    justify-content: center;

    .ivu-modal {
        top: 0;
    }
}

.amap-logo {
    opacity: 0;
}

.amap-copyright {
    opacity: 0;
}
</style>
